<!-- 这个用来显示点赞信息的 -->
<template>
	<view class="like">
		<i class="certishare-icon">
			<span>&#xeca1;</span>
		</i>
		<view class="likenumber">{{ formattedLikeCount }}</view>
	</view>
</template>

<script>
export default {
	data() {
		return {};
	},
	computed: {
		formattedLikeCount() {
			const count = Number(this.likeCount);
			if (isNaN(count)) {
				return '-';
			} else if (count >= 1000) {
				const kCount = Math.floor(count / 1000);
				return `${kCount}k`;
			} else {
				return count.toString();
			}
		}
	},
	props: {
		likeCount: {
			type: String | Number
		}
	}
};
</script>

<style lang="scss">
.like {
	display: flex;
	justify-content: center;
	align-items: center;
	.likenumber {
		font-size: 12px;
		color: #666;
	}
}
</style>
